#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <iterator>

int main(){
	using std::map;
	using std::string;
	using std::ostream_iterator;
	using std::vector;
	using std::cout;
	
	vector<long> v;
	for(int i=0;i<100;i++)
		v.push_back(rand()%1000);
	
	std::copy(v.begin(),v.end(),ostream_iterator<long>(cout,"\n"));
	long sum=std::accumulate(v.begin(),v.end(),0);
	printf("sum is %ld\n",sum);
	
	std::replace(v.begin(),v.end(),513,12341234);
	std::fill(v.begin(),v.end(),55);
	
	std::fill_n(back_inserter(v),10,0);
	
	return 0;
}